<div class="row">
    <div class="col-sm-20">
        <h1 class="pagetitle" translate lib="web">userdetails</h1>
    </div>
</div>

<pre ng-show="ErrorMessage!=null">{{ ErrorMessage }}</pre>
<div ng-show="ctrl.errormessage != ''"" class=" alert alert-danger" role="alert">{{ctrl.errormessage}}</div>
<form ng-submit="ctrl.submit()" class="form-horizontal" role="form" autocomplete="off">

    <div class="form-group">
        <label for="name" class="col-sm-2 control-label" translate lib="web">name</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.name" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group">
        <label for="username" class="col-sm-2 control-label" translate lib="web">username</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.username" class="form-control input-md" ng-disabled="ctrl.loading==true"
                autocomplete="new-password" />
        </div>
    </div>
    <div class="form-group">
        <label for="newpassword" class="col-sm-2 control-label" translate lib="web">password</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.newpassword" class="form-control input-md" style="-webkit-text-security: disc;"
                ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="menuctrl.hasrole('admins') && ctrl.model.email">
        <label for="email" class="col-sm-2 control-label" translate lib="web">email</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.email" class="form-control input-md"
                ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="menuctrl.hasrole('admins') && ctrl.model.company != '' && ctrl.model.company != null && ctrl.model.company != undefined">
        <label for="company" class="col-sm-2 control-label" translate lib="web">company</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.company" class="form-control input-md"
                ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="menuctrl.hasrole('admins') && ctrl.model.remoteip != '' && ctrl.model.remoteip != null && ctrl.model.remoteip != undefined">
        <label for="remoteip" class="col-sm-2 control-label" translate lib="web">remoteip</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.remoteip" class="form-control input-md"
                ng-disabled="ctrl.loading==true" />
                <a ng-href="https://www.iplocation.net/?query={{ctrl.model.remoteip}}" target="_blank">iplocation</a>
        </div>
    </div>
    <div class="form-group" ng-show="menuctrl.hasrole('admins') && (ctrl.model.dblocked == true || ctrl.model.dblocked == false)">
        <label for="dblocked" class="col-sm-2 control-label" translate lib="web">dblocked</label>
        <div class="col-sm-4">
            <input type="checkbox" ng-model="ctrl.model.dblocked" class="input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="menuctrl.hasrole('admins') && (ctrl.model.validated == true || ctrl.model.validated == false)">
        <label for="validated" class="col-sm-2 control-label" translate lib="web">validated</label>
        <div class="col-sm-4">
            <input type="checkbox" ng-model="ctrl.model.validated" class="input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="menuctrl.hasrole('admins') && (ctrl.model.validated == true || ctrl.model.validated == false)">
        <label for="emailvalidated" class="col-sm-2 control-label" translate lib="web">emailvalidated</label>
        <div class="col-sm-4">
            <input type="checkbox" ng-model="ctrl.model.emailvalidated" class="input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="menuctrl.hasrole('admins') && (ctrl.model.validated == true || ctrl.model.validated == false)">
        <label for="formvalidated" class="col-sm-2 control-label" translate lib="web">formvalidated</label>
        <div class="col-sm-4">
            <input type="checkbox" ng-model="ctrl.model.formvalidated" class="input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group">
        <label for="name" class="col-sm-2 control-label" translate lib="web">disabled</label>
        <div class="col-sm-6">
            <input type="checkbox" ng-model="ctrl.model.disabled" class="input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group" ng-show="ctrl.model.sid != '' && ctrl.model.sid != null && ctrl.model.sid != undefined">
        <label for="sid" class="col-sm-2 control-label" translate lib="web">SID</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.sid" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group"
        ng-show="ctrl.model.firebasetoken != '' && ctrl.model.firebasetoken != null && ctrl.model.firebasetoken != undefined">
        <label for="sid" class="col-sm-2 control-label" translate lib="web">Firebase Token</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.firebasetoken" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group"
        ng-show="ctrl.model.onesignalid != '' && ctrl.model.onesignalid != null && ctrl.model.onesignalid != undefined">
        <label for="sid" class="col-sm-2 control-label" translate lib="web">OneSignal Id</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.onesignalid" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label" translate lib="web">providerids</label>
        <div class="col-sm-4">
        </div>
    </div>
    <div class="form-group" ng-repeat="id in ctrl.model.federationids">
        <label class="col-sm-2 control-label" translate lib="web"></label>
        <div class="col-sm-4">
            {{ id }}
            <button type="button" ng-disabled="ctrl.loading==true" class="btn btn-danger" ng-click="ctrl.deleteid(id)"
                translate lib="web">delete</button>
        </div>
    </div>

    <div class="form-inline">
        <div class="form-group mb-2">
            <label class="sr-only" translate lib="web">AddFederationId</label>
        </div>
        <div class="form-group mx-sm-3 mb-2">
            <input ng-model="ctrl.newid" type="text" class="form-control" placeholder="New identity typically email"
                autocomplete="new-password">
        </div>
        <button type="button" class="btn btn-success mb-2" ng-disabled="ctrl.loading==true" ng-click="ctrl.addid()">add
            identity</button>
    </div>




    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" ng-disabled="ctrl.loading==true" class="btn btn-success" translate
                lib="web">save</button>
        </div>
    </div>



    <div class="form-inline" ng-repeat="m in ctrl.memberof">
        <label class="col-sm-1 control-label" translate lib="web">memberof</label>
        <div class="col-sm-3">
            {{ m.name }}
        </div>
        <div class="col-sm-2">
            <button ng-click=" ctrl.RemoveMember(m)" type="button" ng-disabled="ctrl.loading==true"
                class="btn btn-success" translate lib="web">remove</button>
        </div>
        <div class="col-sm-3">
            {{ m._id }}
        </div>
    </div>
</form>

<br>
<hr class="row" ng-show="ctrl.model._id == menuctrl.user._id">
<div class="row" ng-show="ctrl.model._id == menuctrl.user._id">
    <div class="col">admins</div>
    <div class="col">{{menuctrl.hasrole('admins')}}</div>
</div>
<div class="row" ng-show="ctrl.model._id == menuctrl.user._id">
    <div class="col">resellers</div>
    <div class="col">{{menuctrl.hasrole('resellers')}}</div>
</div>
<div class="row" ng-show="ctrl.model._id == menuctrl.user._id">
    <div class="col">customer admins</div>
    <div class="col">{{menuctrl.hasrole('customer admins')}}</div>
</div>
<hr class="row" ng-show="ctrl.model._id == menuctrl.user._id">
<div class="row" ng-repeat="role in menuctrl.user.roles" ng-show="ctrl.model._id == menuctrl.user._id">
    <div class="col">{{role._id}}</div>
    <div class="col">{{role.name}}</div>
</div>